package cn.nubia.admin.sysconfig.controller;

import cn.nubia.admin.common.mybatis.bean.Paged;
import cn.nubia.admin.sysconfig.bean.SystemLog;
import cn.nubia.admin.sysconfig.query.SystemLogQuery;
import cn.nubia.admin.sysconfig.service.SystemLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

/**
 * Created by justin on 15/8/19.
 */
@Controller
@RequestMapping(value = "/admin/system/log")
public class SystemLogController {
    @Autowired
    SystemLogService systemLogService;

    @RequestMapping(value = "/list")
    public ModelAndView list(SystemLogQuery systemLogQuery){
        ModelAndView modelAndView = new ModelAndView("/system/loglist");
        Paged<SystemLog> logPaged = systemLogService.findPagedByQuery(systemLogQuery);
        modelAndView.addObject("logs",logPaged);
        modelAndView.addObject("modules", SystemLog.ModuleTypeEnum.getModules());
        modelAndView.addObject("query",systemLogQuery);
        return modelAndView;
    }
}
